﻿using Microsoft.WindowsAzure.ServiceRuntime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace POC.Azure.Settings
{
    public class AzureSettings
    {
        public static readonly string AzureInstanceID;
        public static readonly string AzureDeploymentID;
        static AzureSettings()
        {
            try
            {
                if (RoleEnvironment.IsAvailable)
                {
                    AzureInstanceID = RoleEnvironment.CurrentRoleInstance.Id;
                    AzureDeploymentID = RoleEnvironment.DeploymentId;
                }

                else
                {
                    AzureInstanceID = AppDomain.CurrentDomain.FriendlyName;
                    AzureDeploymentID = Guid.Empty.ToString();
                }
            }
            catch (Exception ciolsx)
            {
                AzureInstanceID = AppDomain.CurrentDomain.FriendlyName;
                AzureDeploymentID = Guid.Empty.ToString();
            }
        }
    }
}
